<?php

$dsn = new PDO("mysql:dbname=myblog;host=127.0.0.1", "root", "mysql");
$postIds = $dsn->query("select id from tbl_post");
$postIds = $postIds->fetchAll(PDO::FETCH_NUM);

foreach ($postIds as $postid)
{
        $postid = (int)$postid[0];
        $dsn->exec("insert into tbl_postviews values($postid,1)");
}